package com.mf.service.impl.pageConfig;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mf.entity.bo.pageConfig.BasicPageBo;
import com.mf.entity.request.pageConfig.PageBoSearchReq;
import com.mf.mapper.BasicPageMapper;

import com.mf.service.pageConfig.IBasicPageService;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jakarta.annotation.Resource;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

/**
*  服务实现类
*
* @author mf
* @since 2024-12-19
*/
@Service
public class BasicPageServiceImpl extends ServiceImpl<BasicPageMapper, BasicPageBo> implements IBasicPageService {
    @Resource
    private BasicPageMapper pageMapper;
    @Override
    public Page<BasicPageBo> findPageList(PageBoSearchReq pageBoSearchReq) {
        Page<BasicPageBo> pageBoPage = new Page<>(pageBoSearchReq.getPageNum(), pageBoSearchReq.getPageSize());
        LambdaQueryWrapper<BasicPageBo> queryWrapper = new LambdaQueryWrapper<>();
        if(StringUtils.isNotBlank(pageBoSearchReq.getPname())){
            queryWrapper.eq(BasicPageBo::getPname, pageBoSearchReq.getPname());
        }
        return pageMapper.selectPage(pageBoPage,queryWrapper);
    }
}
